package main

import "fmt"

func main(){
    personMap := make(map[string]string)

    fmt.Println("=========添加")
    //添加
    personMap["name"] = "JackyChen"
    personMap["age"] = "18"
    personMap["sex"] = "男"
    printMap(personMap)

    fmt.Println("=========修改")
    //修改
    //personMap["age"] = "25"
    changeMap(personMap)
    printMap(personMap)

    fmt.Println("=========删除")
    //删除
    delete(personMap,"age")
    printMap(personMap)
}

//personMap是一个指针引用传递
func printMap(personMap map[string]string){
    for key,value := range personMap{
        fmt.Println("key = ",key,", value = ",value)
    }
}

func changeMap(personMap map[string]string){
    personMap["sex"] = "女"
}